package xy.params.controller;

import org.hibernate.validator.constraints.Length;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import xy.params.entity.User;

@Validated
@RestController
public class UserController {

    @PostMapping("validate")
    public User validate(@RequestBody @Validated User user) {
        return user;
    }


    @GetMapping("validate2")
    public String validate2(@RequestParam("halo")  @Length(min = 6, max = 16) String halo) {
        return halo;
    }

    @GetMapping("validate3/{halo}")
    public String validate3(@PathVariable("halo") @Length(min = 6, max = 16) String halo) {
        return halo;
    }
}
